<?php
header("Content-Type:text/html; charset=utf-8");

$this->load->view("header");
?>

<script type="text/javascript">

function vote(userid) {
	var temp = document.getElementById("ticket_"+userid);
	var number = temp.value;
	if ((/^(\+|-)?\d+$/.test( number )) && number>0) {
		var r=confirm("确认修改票数吗?");
		if (r==true) {
			window.location="<?php get_config('base_url'); ?>?type="+<?php echo $type; ?>+"&protocal=1201"+"&target="+userid+"&number="+number;
		}
	}
	else
    {
	    alert("只能是正整数");
    }
}

function shield(userid, shield) {
	var temp = !shield;
	if (temp) {
		var r=confirm("确认要屏蔽该用户吗? ");
	}
	else {
		var r=confirm("确认要解锁该用户吗? ");
	}
	if (r==true) {
		window.location="<?php get_config('base_url'); ?>?type="+<?php echo $type; ?>+"&protocal=1202"+"&target="+userid+"&shield="+temp;
	}
}

function order(column, direct) {
	window.location="<?php get_config('base_url'); ?>?type="+<?php echo $type; ?>+"&protocal=1005&order="+column+"&direct="+direct;
}
</script>

<h2 style="background-color:red;"><?php echo $msg; ?></h2>

<form method="post" action="<?php get_config('base_url'); ?>?type=<?php echo $type; ?>&protocal=1005" >
<input type="text" name="username" />
<input type="submit" name="submit" value="按用户名过滤" /> 
</form>

<br />

<table id="t1" border="1" cellpadding="5">

	<tr>
		<th scope="col" width="80"><a href="#" onClick="order('username', 'asc')">升序</a> 用户名 <a href="#" onClick="order('username', 'desc')">降序</a></th>
		<th scope="col" width="40"><a href="#" onClick="order('number_vote', 'asc')">升序</a> 票数 <a href="#" onClick="order('number_vote', 'desc')">降序</a></th>
		<th scope="col" width="80"><a href="#" onClick="order('ranking', 'asc')">升序</a> 排名 <a href="#" onClick="order('ranking', 'desc')">降序</a></th>
		<th scope="col" width="150"><a href="#" onClick="order('latest_time_vote', 'asc')">升序</a> 最后一次被投时间 <a href="#" onClick="order('latest_time_vote', 'desc')">降序</a></th>
		<th scope="col" width="150"><a href="#" onClick="order('create_time', 'asc')">升序</a> 创建时间 <a href="#" onClick="order('create_time', 'desc')">降序</a></th>
		<th scope="col" width="40"><a href="#" onClick="order('shield', 'asc')">升序</a> 是否屏蔽 <a href="#" onClick="order('shield', 'desc')">降序</a></th>
		<th scope="col" COLSPAN=3>Action</th>
	</tr>

	<?php foreach ($cover_gril_list as $aItem){ ?>
	<tr>
		<td><?php echo $aItem->username; ?></td>
		<td><?php echo $aItem->number_vote; ?></td>
		<td><?php echo $aItem->ranking; ?></td>
		<td><?php echo $aItem->latest_time_vote; ?></td>
		<td><?php echo $aItem->create_time; ?></td>
		<td><?php echo $aItem->shield; ?></td>
		<td width="10" align="left"><input type="text" id="ticket_<?php echo $aItem->userid ?>" ></input>
		</td>
		<td width="70" align="left"><a href="#" onClick="vote(<?php echo $aItem->userid ?>)">增加票数</a>
		</td>
		<td width="40" align="left"><a href="#" onClick="shield(<?php echo $aItem->userid; echo ','; echo $aItem->shield; ?>)"><?php if ($aItem->shield != 0) echo "解锁"; else echo "屏蔽"; ?></a>
		</td>
	</tr>

	<?php }?>
</table>


<?php
$this->load->view("footer");
?>